package Testing;


//import java.util.ArrayList;
import java.util.Calendar;
//import java.util.Date;
import java.util.GregorianCalendar;

import utility.LeaveUtil;

import dao.*;
import dao.mysql.*;
import dto.*;

public class DatabaseTest
{

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		//ArrayList<UserDTO> userList;
		
//		EmployeeDAOFactoryImpl Efac = new EmployeeDAOFactoryImpl();
//		EmployeeDAO empDAO = Efac.getEmployeeDAO();
		
		LeaveDAOFactoryImpl LFac = new LeaveDAOFactoryImpl();
		LeaveDAO LDao = LFac.getLeaveDAO();
		
		try
		{
//			UserDTO u = LDao.findByCriteria(1001);
		//userList = empDAO.findAllUser();
//		UserDTO newuser = new UserDTO();
//		newuser.set_age(22);
//		newuser.set_annualLeave(10.00);
//		newuser.set_compensationLeave(5.00);
//		newuser.set_domain("staff");
//		newuser.set_gender("f");
//		newuser.set_medicalLeave(10.00);
//		newuser.set_name("SaYuchen");
//		newuser.set_overTimeDays(5.00);
//		newuser.set_password("chen");
//		newuser.set_staffType("Admin");
//		newuser.set_supID(1003);
//		newuser.set_userID(1008);
//
//		empDAO.deleteUser(newuser);
//		for(UserDTO a : userList)
//		{
//			System.out.println(u.get_name());
//			System.out.println(u.get_gender());
//		}
			
//		for(LeaveDTO a : LDao.getLeaveHistory(1001))
//			{
//				System.out.println(a.get_reason());
//				System.out.println(a.get_status());
//			}	
			
//			LeaveDTO newleave = new LeaveDTO();
//			Calendar cale = Calendar.getInstance();
//			cale.set(2010,9,23);
//			Calendar cals = new GregorianCalendar();
//			cals.set(2010,8,11);
//			
//			newleave.set_ApprovingManID(1003);
//			newleave.set_endDate(cale.getTime());
//			newleave.set_endDateHalfDay("PM");
//			newleave.set_leaveType("Annual");
//			newleave.set_reason("Go Swimming");
//			newleave.set_startDate(cals.getTime());
//			newleave.set_startDateHalfDay("PM");
//			newleave.set_status("Approved");
//			newleave.set_userID(1010);
//			newleave.set_workDissemination("Ask Panji to do!");
//			newleave.set_leaveID(3008);
//			
//			LDao.removeFromDatabase(newleave);
			
//			LeaveSearchDTO lsdto = new LeaveSearchDTO();
//			Calendar cals = new GregorianCalendar(2010,10,20);
//			cals.set(2010,10,20);
//			System.out.println(Calendar.DAY_OF_MONTH);
//			System.out.println(Calendar.MONTH);
//			System.out.println(Calendar.YEAR);
//			Calendar cale = Calendar.getInstance();
//			cale.set(2010,10,25);
//			System.out.println(Calendar.DAY_OF_MONTH);
			//System.out.println(LeaveUtil.getDuration(cals.getTime(), cale.getTime()));
			
//			lsdto.set_ApprovingmanID(1003);
			//lsdto.set_endDate(cale.getTime());
			//lsdto.set_startDate(cals.getTime());
			//lsdto.set_userID(1010);
//			lsdto.set_userName("SaYuchen");
//			
//			for(LeaveDTO a : LDao.findLeaveByCriteria(lsdto))
//			{
//				System.out.println(a.get_reason());
//				System.out.println(a.get_status());
//			}	
//			
			
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}

}
